package com.travel.common.util;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/**
 * @Author: LiZhenhui
 * @Date: 2018/10/26 15:43
 * @Desc:
 */
public class CollectionUtil {

    public static <T> T getFirst(List<T> list) {
        return isNotEmpty((Collection)list) ? list.get(0) : null;
    }

    private static boolean isNotEmpty(Collection collection) {
        return !isEmpty(collection);
    }

    public static boolean isEmpty(Collection collection) {
        return null == collection || collection.size() == 0;
    }
}
